#! /usr/bin/env python
#################################################################################
#     File Name           :     test5.py
#     Created By          :     xiaogebin
#     Creation Date       :     [2023-09-17 21:57]
#     Last Modified       :     [2023-09-17 22:04]
#     Description         :
#################################################################################

import asyncio, time, threading


def start_loop(loop):
    """TODO: Docstring for start_loop.

    :loop: TODO
    :returns: TODO

    """
    asyncio.set_event_loop(loop)
    loop.run_forever()


async def fun1(name):
    print(name)
    await asyncio.sleep(1)
    print("...........")


def main():
    """TODO: Docstring for main.
    :returns: TODO

    """
    coroutine1 = fun1("xiaogebin")

    new_loop = asyncio.new_event_loop()

    t = threading.Thread(target=start_loop, args=(new_loop, ))
    t.start()

    asyncio.run_coroutine_threadsafe(coroutine1, new_loop)
    for i in "iloveu":
        print(str(i) + "    ")


if __name__ == "__main__":
    main()
